This is the script for steps 1 to 3 of manually creating a compressible NAND.
-----------
Things needed: 
SMS_MBR.bin                (Samsung MBR, =KMAPF0000M_MBR.bin)
ST_MBR.bin                 (ST MBR, =NAND02GAH0LZC5r30_MBR.bin)
twl_main_VBR_00bytes.bin   (twl_main VBR + 00bytes file tables)
twl_photo_VBR_00bytes.bin  (twl_photo VBR + 00bytes file tables)
Stage2.bin                 (Select a Stage2 '.nand' file and rename it to Stage2.bin)
twltool.exe                (TWLTool)

*This attachment does not include Stage2 and TWLTool.

-----------
Usage instructions:
create_nand.py   

-----------
Complete process:
1. Enter consoleid (8bytes) and CID (16bytes)
2. Select MBR based on the last two bytes of CID
3. Create a 240 MB all-zero file nand.bin and write the MBR at the beginning
4. First encryption: nand.bin -> nand.enc.bin
5. Overwrite nand.enc.bin with: Stage2.bin (0x00), MBR (overwrite 0x00 again), twl_main_VBR_00bytes.bin (0x10EE00), twl_photo_VBR_00bytes.bin (0xCF09A00)
6. Second encryption: nand.enc.bin -> nand.enc2.bin
7. Append data to nand.enc2.bin based on eMMC type:
- SMS eMMC: directly append no$gba footer (64bytes))
- ST eMMC: first append 0x580000 bytes of zero, then append footer
8. Delete the intermediate files nand.bin and nand.enc.bin, keeping only nand.enc2.bin









